import org.w3c.dom.NameList;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class Child extends Parent{

    public Child(String name,int age) {
        this.name = name;
        this.age = age;
    }

    private String name;
    private int age;

    @Override
    public boolean equals(Object o) {
        System.out.println("equals " + o);
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Child child = (Child) o;
        return age == child.age && Objects.equals(name, child.name);
    }

    @Override
    public int hashCode() {
        System.out.println("hashcode ");
        return Objects.hash(name);
    }

    @Override
    public String toString() {
        return "Child{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
